package com.kzn.service;

import com.kzn.entity.Project;
import com.baomidou.mybatisplus.extension.service.IService;
import org.springframework.web.multipart.MultipartFile;

import javax.servlet.http.HttpServletResponse;

/**
 * <p>
 * 服务类
 * </p>
 *
 * @author sorclown
 * @since 2022-02-05
 */
public interface IProjectService extends IService<Project> {

    /**
     * 检查是否有完成的项目
     *
     * @return
     */
    boolean checkOverProject();

    /**
     * 切割任务
     *
     * @param project
     * @param AdminId
     * @return
     */
    boolean splitToTask(Project project, int AdminId);


    /**
     * 获得项目进度
     * @param projectId 项目ID
     * @param particleSize 项目粒度
     * @return  项目进度
     */
    Double getProjectPercentage(Integer projectId, String particleSize);

    /**
     * 插入一个 project
     *
     * @param project
     * @param publisherId
     * @return
     */
    boolean insertOne(Project project, int publisherId);

    /**
     * 上传压缩包
     *
     * @param projectId
     * @param multipartFile
     * @return
     */
    boolean uploadResource(Integer projectId, MultipartFile multipartFile);


    /**
     * 下载结果
     * @param projectId
     * @param type
     * @return
     */
    String getResultByProjectId(Integer projectId, String type, HttpServletResponse res);

    /**
     * 下载原数据
     * @param projectId
     * @return
     */
    String getResourceById(Integer projectId,  HttpServletResponse res);
}
